import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

import adminLabRoute from './admin-modules'
import loginRoutes from './common-modules/login'
import specialPageRoutes from './common-modules/special-page' // 特殊页面
import customerRoute from './customer-modules'
import onlineLabRoute from './online-lab-modules'

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/customer'
  },
  // 特殊页面
  ...specialPageRoutes,
  // 登陆
  ...loginRoutes,
  //用户端
  customerRoute,
  //在线实验室
  onlineLabRoute,
  //系统管理
  adminLabRoute,
  {
    path: '/test',
    // component: () => import('@/views/test-video.vue')
    component: () => import('@/views/test-gtable.vue')
  },
  {
    path: '/403',
    component: () => import('@/views/error-page/403.vue'),
    meta: { title: '404' }
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404.vue'),
    meta: { title: '404' }
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404'
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
